<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>14_jQuery-CSS基本操作</title>
</head>
<body>

  <ul id="list" class="panel">
    <li class="li-1">li-1</li>
    <li class="li-2">li-2</li>
    <li class="li-3">li-3</li>
    <li class="li-4">li-4</li>
    <li class="li-5">li-5</li>
  </ul>

  <script src="../libs/jquery-3.6.0.js"></script>
  <script>
    $(function() {
      // 1. 获取css样式
      console.log( $('#list').css('width') )
      console.log( $('#list').css('height') )

      // 2. 设置css样式
      $('#list').css('width', '200px')
      $('#list').css('height', '200px')
      $('#list').css('backgroundColor', 'red')

      // 3. 批量设置css样式
      $('#list').css({
        width: '300px',
        height: '300px',
        backgroundColor: 'green',
        border: '1px solid green'
      })

      // 4. width() 和 height() 方法
      console.log( $('#list').width(300) )
      console.log( $('#list').height('500px') )

      // 5. 链式调用
      $('#list li').css('width', '400px').odd().css('height', '400px').css('backgroundColor', 'blue')
      
    })

  </script>
  
</body>
</html>